<?php
// +-------------------------------------------------------------------
// | 
// +-------------------------------------------------------------------
// | Copyright (c) 2009-2016 All rights reserved.
// +-------------------------------------------------------------------
namespace Admin\Controller;

use Kcdns\Admin\Controller\CommonController;

class CommissionLogController extends CommonController
{
	
	public function index()
	{
	     $typeArray = [1,2,12,13,14,15,16,17];
	    foreach ($typeArray as $type){
	    	$array[$type] = M('commission_log')->where(['type'=>$type])->sum('money')?:0;
	    } 
	    $this->assign('total',array_sum($array));
	    $this->assign('array',$array);
		parent::index();
	}
	
    public function genMonthBounds()
    {
        try {
            OE('user')->genMonthBounds();
            $this->success('操作成功');
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
    }

    public function genYearBounds()
    {
        try {
            OE('user')->genYearBounds();
            $this->success('操作成功');
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
    }
}